<?php
class PushError extends Exception {
	
	private 
		$_top,
		$_parent,
		$user_message = '',
		$log_id = '';
	
	public function __construct($top,$parent,$sys_msg,$message)
	{
		$this->_top =& $top;
		$this->_parent =& $parent;
		
		parent::__construct($sys_msg,0);
		$this->user_message = $message;
		
		$sys_message = $this->_parent->prepareValueForSQL($this->getMessage());
		$user_message = $this->_parent->prepareValueForSQL($this->getUserMessage());
		$trace = $this->_parent->prepareValueForSQL($this->getTraceAsString());
		$script_file = $this->_parent->prepareValueForSQL($this->getFile());
		$script_line = $this->getLine();
		
		$this->_top->_sql->exeDummy ("INSERT INTO ".TAB_PREF."exception_log (sys_message,user_message,trace,script_file,script_line) VALUES ('$sys_message','$user_message','$trace','$script_file','$script_line');");
		$this->log_id = $this->_top->_sql->last_insert_id();
	}
	
	public function getUserMessage()
	{
		return $this->user_message;
	}
	
	public function getLogId()
	{
		return $this->log_id;
	}
	
	
}
?>